//
//  LSZDailyCheckViewController.m
//  JKFuYinProject
//
//  Created by 九酷 on 2018/6/7.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "LSZDailyCheckViewController.h"

@interface LSZDailyCheckViewController ()<UITableViewDelegate,UITableViewDataSource,UITextViewDelegate>
{
    UIView * viewBackRules;
    UIView * viewRules;

    UIView * viewBackSuccessfully;
    UIView * viewSuccessfully;
    UIButton * butCancel;
}
@property(nonatomic,strong) UIButton * butSignIn;
@property(nonatomic,strong) UITableView * tableViewSignIn;
@property(nonatomic,strong) LSZSignInformationManager * signInformationManager;

@property(nonatomic,strong) UIImageView * imageViewPublic;
@property(nonatomic,strong) UIImageView * imageViewPrivacy;
@property(nonatomic,strong) UILabel * countLabel;
@property(nonatomic,strong) NSString * is_open;// 1私密  默认0公开
@property(nonatomic,strong) TPKeyboardAvoidingScrollView * PopupScrollView;
@property(nonatomic,strong) UITextView * textViewLeaveMessage;
@property(nonatomic,assign) NSInteger page;
@property(nonatomic,strong) NSMutableArray * arrayCheckRecord;

@property(nonatomic,strong)UIView * viewLow;
@end

@implementation LSZDailyCheckViewController

-(void)getSignInformation
{
    __weak typeof(self) weakSelf = self;
    [LSZRequestResolutionDic getCheckInInformation:^(BOOL isoK, NSString * string, LSZSignInformationManager * manger) {
        if (isoK == YES) {
            weakSelf.signInformationManager = manger;
            LSZSignInformationMg * mg = nil;
            mg = manger.arrayData[0];
            if ([mg.is_sign_m  isEqualToString:@"1"]) {
                [weakSelf setLowUIView];
                weakSelf.butSignIn.backgroundColor = redUIColor;
                weakSelf.butSignIn.userInteractionEnabled = YES;
                [weakSelf redesignUI];
            }
            if ([mg.is_sign_n  isEqualToString:@"1"]) {
                [weakSelf setLowUIView];
                [self.butSignIn setTitle:@"晚祷告" forState:UIControlStateNormal];
                weakSelf.butSignIn.backgroundColor = redUIColor;
                weakSelf.butSignIn.userInteractionEnabled = YES;
                [weakSelf redesignUI];
            }
            [weakSelf.tableViewSignIn reloadData];
        }else{
            [weakSelf setStringWarning:string];
        }
    }];
}
-(void)redesignUI
{
    if (ScreenWidth == 320) {
        //5
        _tableViewSignIn.frame = CGRectMake(0,NAVIGATION_BAR_HEIGHT,ScreenWidth,ScreenHeight-62-NAVIGATION_BAR_HEIGHT-HOME_INDICATOR_HEIGHT);
    }else if(ScreenWidth == 375){
        // 6 7
        _tableViewSignIn.frame = CGRectMake(0,NAVIGATION_BAR_HEIGHT,ScreenWidth,ScreenHeight-64-NAVIGATION_BAR_HEIGHT-HOME_INDICATOR_HEIGHT);
    }else {
        //plus
        _tableViewSignIn.frame = CGRectMake(0,NAVIGATION_BAR_HEIGHT,ScreenWidth,ScreenHeight-66-NAVIGATION_BAR_HEIGHT-HOME_INDICATOR_HEIGHT);
    }
}
-(void)getDailyCheckRecordData :(NSInteger)page
{
    __weak typeof(self) weakSelf = self;
    [LSZRequestResolutionDic userCheckRecord:@"0" page:[NSString stringWithFormat:@"%zd",(long)page] type:@"2" :^(BOOL isOk, NSString * string, LSZSignRecordManager * manager) {
        if (isOk == YES) {
            if (weakSelf.page == 1) {
                [weakSelf.arrayCheckRecord removeAllObjects];
                if(manager.arrayData.count == 0){
                    weakSelf.tableViewSignIn.mj_footer.hidden = YES;
                }else{
                    [weakSelf.arrayCheckRecord setArray:manager.arrayData];
                }
            }
            else{
                [weakSelf.arrayCheckRecord addObjectsFromArray:manager.arrayData];
            }
            if(manager.arrayData.count == 0){
                [weakSelf.tableViewSignIn.mj_footer endRefreshingWithNoMoreData];
            }
            [weakSelf.tableViewSignIn reloadData];
        }else{
            [weakSelf setStringWarning:string];
        }
    }];
}
#pragma mark - 签到
-(void)mySignIn
{
    __weak typeof(self) weakSelf = self;
    [LSZRequestData userSignIn:@"" is_open:@"" type:@"1":^(BOOL isOk, NSString * string, NSDictionary * dic) {
        [weakSelf getSignInformation];
        if (isOk == YES) {
            //此处添加成功的
            [weakSelf setStringWarning:@"签到成功!"];
//            [self signInSuccessfully :dic];//这个不用了
        }
    }];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"每日签到";
    self.is_open = @"0";
    self.page = 1;
    self.arrayCheckRecord = [[NSMutableArray alloc]init];
    [self mySignIn];
    [self getDailyCheckRecordData:self.page];

    UIButton *but = [UIButton buttonWithType:UIButtonTypeCustom];
    but.frame =CGRectMake(0,0, 24, 24);
    [but setImage:[UIImage imageNamed:@"签到_更多"] forState:UIControlStateNormal];
    but.tag = 1;
    [but addTarget:self action:@selector(clickButRules:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem  *barBut = [[UIBarButtonItem alloc]initWithCustomView:but];
    self.navigationItem.rightBarButtonItem = barBut;

    [self.tableViewSignIn registerClass:[LSZHeaderValueTableViewCell class] forHeaderFooterViewReuseIdentifier:@"LSZHeaderValueTableViewCell"];
    [self.tableViewSignIn registerClass:[LSZDaysRecordsTableViewCell class] forCellReuseIdentifier:@"LSZDaysRecordsTableViewCell"];
    [self.tableViewSignIn registerClass:[LSZCheckDailyGospelValuesTableViewCell class] forCellReuseIdentifier:@"LSZCheckDailyGospelValuesTableViewCell"];
    [self.tableViewSignIn registerClass:[LSZRulesTableViewCell class] forCellReuseIdentifier:@"LSZRulesTableViewCell"];
    [self.tableViewSignIn registerClass:[LSZSignRecordContentTableViewCell class] forCellReuseIdentifier:@"LSZSignRecordContentTableViewCell"];
    __weak typeof(self) weakSelf = self;
    weakSelf.tableViewSignIn.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        // 进入刷新状态后会自动调用这个block
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            // 刷新表格  和结束刷新
            weakSelf.page = 1;
            [weakSelf getDailyCheckRecordData:weakSelf.page];
            [weakSelf.tableViewSignIn.mj_header endRefreshing];
        });
    }];
    // 上拉刷新
    weakSelf.tableViewSignIn.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
        // 进入刷新状态后会自动调用这个block
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            // 刷新表格  和结束刷新
            weakSelf.page++;
            [weakSelf getDailyCheckRecordData:weakSelf.page];
            [weakSelf.tableViewSignIn.mj_footer endRefreshing];
        });
    }];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    LSZSignInformationMg * mg = nil;
    mg = self.signInformationManager.arrayData[0];
    if([mg.sign_m isEqualToString:@"1"]){
        return 4;
    }else{
        return 3;//先暂时2个区  本来是3个区
    }
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    LSZSignInformationMg * mg = nil;
    mg = self.signInformationManager.arrayData[0];
    if (section == 0) {
        return 2;
    }else if (section == 1){
        return 1;
    }else if([mg.sign_m isEqualToString:@"1"]&&section == 2){
        return 1;
    }
    else{
        return self.arrayCheckRecord.count+1;
    }
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    LSZSignInformationMg * mg = nil;
    mg = self.signInformationManager.arrayData[0];
    if (section == 0) {
        if (ScreenWidth == 320) {
            //5
            return 130;
        }else if(ScreenWidth == 375){
            // 6 7
            return  140;
        }else {
            //plus
            return 148;
        }
    }else if ([mg.sign_m isEqualToString:@"1"]&&section == 2){
        if (ScreenWidth == 320) {
            //5
            return 40;
        }else if(ScreenWidth == 375){
            // 6 7
            return 45;
        }else {
            //plus
            return 50;
        }
    }else{
        return 0.0001;
    }
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    LSZSignInformationMg * mg = nil;
    mg = self.signInformationManager.arrayData[0];
    if (indexPath.section == 0) {
        if (indexPath.row == 0) {
            if (ScreenWidth == 320) {
                //5
                return 40;
            }else if(ScreenWidth == 375){
                // 6 7
                return 50;
            }else {
                //plus
                return 58;
            }
        }else{
            float ratioValue = ScreenWidth/375;
            if (ScreenWidth == 320) {
                //5
                return 55+44*ratioValue;//91;
            }else if(ScreenWidth == 375){
                // 6 7
                return 57+44*ratioValue;//101;
            }else {
                //plus
                return 59+44*ratioValue;//119;
            }
        }
    }else if (indexPath.section == 1){
        int a;
        if (ScreenWidth == 320) {
            //5
            a = 36;
        }else if(ScreenWidth == 375){
            // 6 7
            a = 38;
        }else {
            //plus
            a = 40;
        }
        CGFloat width = (ScreenWidth - 40 -1) / 3+10+a;
        return width;
    }else if ([mg.sign_m isEqualToString:@"1"]&&indexPath.section == 2){
        CGFloat height = [self initWithCheckStrHeigh:mg.content_m];
        if (ScreenWidth == 320) {
            //5
            return 78+height;
        }else if(ScreenWidth == 375){
            // 6 7
            return 89+height;
        }else {
            //plus
            return 95+height;
        }
    }
    else{
        if (indexPath.row == 0) {
            if (ScreenWidth == 320) {
                //5
                return 40;
            }else if(ScreenWidth == 375){
                // 6 7
                return 45;
            }else {
                //plus
                return 50;
            }
        }else{
            LSZSignRecordMg * SignRecordMg = nil;
            SignRecordMg = self.arrayCheckRecord[indexPath.row-1];
            CGFloat height = [self initWithCheckStrHeigh:SignRecordMg.content];
            if (ScreenWidth == 320) {
                //5
                return 78+height;
            }else if(ScreenWidth == 375){
                // 6 7
                //            return 18+19+7+height+15+14+18;
                return 89+height;
            }else {
                //plus
                return 95+height;
            }
        }
    }
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    LSZSignInformationMg * mg = nil;
    mg = self.signInformationManager.arrayData[0];
    if (section == 0) {
        LSZHeaderValueTableViewCell * cell= [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"LSZHeaderValueTableViewCell"];
        if([NullStringjudgment(mg.credit) isEqualToString:@""]){
            cell.labelRemainingValue.text = [NSString stringWithFormat:@"我的福音值:"];
        }else{
            cell.labelRemainingValue.text = [NSString stringWithFormat:@"我的福音值:%@",mg.credit];
        }
        [cell.butList addTarget:self action:@selector(clickButList) forControlEvents:UIControlEventTouchUpInside];
        return cell;
    }else{
        UITableViewHeaderFooterView * headerCell = [tableView dequeueReusableHeaderFooterViewWithIdentifier:@"cell"];
        if (!headerCell) {
            headerCell = [[UITableViewHeaderFooterView alloc]initWithReuseIdentifier:@"cell"];
        }
        if ([mg.sign_m isEqualToString:@"1"]&&section == 2){
            headerCell.textLabel.text = @"我的早祷告留言";
            headerCell.textLabel.textColor = titleColorLSZ;
            headerCell.contentView.backgroundColor = [UIColor whiteColor];
        }else{
            headerCell.textLabel.text = @"";
        }
        if (ScreenWidth == 320) {
            //5
            headerCell.textLabel.font = FONT_(14.5);
        }else if(ScreenWidth == 375){
            // 6 7
            headerCell.textLabel.font = FONT_(15);
        }else {
            //plus
            headerCell.textLabel.font = FONT_(15.5);
        }
        return headerCell;
    }
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    LSZSignInformationMg * mg = nil;
    mg = self.signInformationManager.arrayData[0];
    __weak typeof(self) weakSelf = self;
    if (indexPath.section == 0) {
        if (indexPath.row == 0) {
            LSZDaysRecordsTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"LSZDaysRecordsTableViewCell" forIndexPath:indexPath];
            if([NullStringjudgment(mg.signin_days) isEqualToString:@""]){
                cell.labelTitle.text = [NSString stringWithFormat:@"已连续签到"];
            }else{
                cell.labelTitle.text = [NSString stringWithFormat:@"已连续签到%@天",mg.signin_days];
            }
            CGFloat widthLabelTitle = [LSZSpecialPackaging getsTheAdaptiveWidth:cell.labelTitle sizeMaxWidth:ScreenWidth/2];
            CGRect rect = cell.labelTitle.frame;
            rect.size.width = widthLabelTitle;
            cell.labelTitle.frame = rect;
            [cell.butSignIn addTarget:self action:@selector(clickViewCheckRecords) forControlEvents:UIControlEventTouchUpInside];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            return cell;
        }
        else  if (indexPath.row == 1) {
            LSZCheckDailyGospelValuesTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"LSZCheckDailyGospelValuesTableViewCell" forIndexPath:indexPath];
            cell.signInformationMg = mg;
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            return cell;
        }else{
            UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
            if (!cell) {
                cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
            }
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            return cell;
        }
    }else if (indexPath.section == 1){
        LSZRulesTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"LSZRulesTableViewCell" forIndexPath:indexPath];
        cell.myCollectionView.model = self.signInformationManager;
        [cell.labelMovew tapGesture:^(UIGestureRecognizer *ges) {
            [weakSelf goToShopping];
        }];
        cell.myCollectionView.pushBlock = ^(LSZSignInformationMg *signInformationMg) {
            LSZFindOutMoreVC *viewController = [[LSZFindOutMoreVC alloc] init];
            viewController.type = @"2";
            viewController.link = signInformationMg.url;
            [weakSelf.navigationController pushViewController:viewController animated:YES];
        };

        cell.butRules.tag = 2;
        [cell.butRules addTarget:self action:@selector(clickButRules:) forControlEvents:UIControlEventTouchUpInside];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        return cell;
    }else if ([mg.sign_m isEqualToString:@"1"]&&indexPath.section == 2){
        LSZSignRecordContentTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"LSZSignRecordContentTableViewCell" forIndexPath:indexPath];
        [self myMessageIsPrayer:cell :mg];
        return cell;
    }
    else{
        if (indexPath.row == 0) {
            UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
            if (!cell) {
                cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
            }
            cell.textLabel.text = @"早祷留言";
            cell.textLabel.textColor = titleColorLSZ;
            if (ScreenWidth == 320) {
                //5
                cell.textLabel.font = FONT_(14.5);
            }else if(ScreenWidth == 375){
                // 6 7
                cell.textLabel.font = FONT_(15);
            }else {
                //plus
                cell.textLabel.font = FONT_(15.5);
            }
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            return cell;
        }else{
            LSZSignRecordContentTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"LSZSignRecordContentTableViewCell" forIndexPath:indexPath];
            [self leaveMessageAndPray:cell :indexPath];
            return cell;
        }
    }
}
#pragma mark - 我的祷告留言
-(void)myMessageIsPrayer:(LSZSignRecordContentTableViewCell*)cell :(LSZSignInformationMg *)mg
{
    [cell.imageViewHeader sd_setImageWithURL:[NSURL URLWithString:mg.avatar] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    cell.labelName.text = mg.username;
    CGFloat height = [self initWithCheckStrHeigh:mg.content_m];
    CGRect rect  = cell.labelConten.frame;
    rect.size.height = height;
    cell.labelConten.frame = rect;
    if ([mg.content_m isEqualToString:@""]||mg.content_m.length == 0) {
        cell.labelConten.text =  @"无签到留言";
    }else{
        cell.labelConten.text = mg.content_m;
    }
    CGRect rect1  = cell.labelTime.frame;
    rect1.origin.y = CGRectGetMaxY(cell.labelConten.frame)+15;
    cell.labelTime.frame = rect1;
    cell.labelTime.text = mg.uptime_m;

    CGRect rect2  = cell.butZan.frame;
    rect2.origin.y = CGRectGetMaxY(cell.labelConten.frame)+5;
    cell.butZan.frame = rect2;
    cell.labelZan.text = mg.click_m;
    cell.imageViewZan.image = [UIImage imageNamed:@"我的_签到_留言_点赞"];
    cell.imageViewZan.userInteractionEnabled = NO;
    cell.butZan.userInteractionEnabled = NO;
    cell.labelZan.userInteractionEnabled = NO;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
#pragma mark - 全部的留言
-(void)leaveMessageAndPray :(LSZSignRecordContentTableViewCell*)cell :(NSIndexPath *)indexPath
{
    LSZSignRecordMg * mg = nil;
    mg = self.arrayCheckRecord[indexPath.row-1];
    __weak typeof(self) weakSelf = self;
    [cell.imageViewHeader sd_setImageWithURL:[NSURL URLWithString:mg.avatar] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    [cell.imageViewHeader tapGesture:^(UIGestureRecognizer *ges) {
        LSZPersonalInformationPageVC * vc = [[LSZPersonalInformationPageVC alloc]init];
        vc.uid =mg.uid;
        vc.imageViewHeader = mg.avatar;
        [weakSelf.navigationController pushViewController:vc animated:YES];
    }];
    cell.labelName.text = mg.username;
    CGFloat height = [weakSelf initWithCheckStrHeigh:mg.content];
    CGRect rect  = cell.labelConten.frame;
    rect.size.height = height;
    cell.labelConten.frame = rect;
    if ([mg.content isEqualToString:@""]||mg.content.length == 0) {
        cell.labelConten.text =  @"无签到留言";
    }else{
        cell.labelConten.text = mg.content;
    }
    CGRect rect1  = cell.labelTime.frame;
    rect1.origin.y = CGRectGetMaxY(cell.labelConten.frame)+15;
    cell.labelTime.frame = rect1;
    cell.labelTime.text = mg.uptime;

    CGRect rect2  = cell.butZan.frame;
    rect2.origin.y = CGRectGetMaxY(cell.labelConten.frame)+5;
    cell.butZan.frame = rect2;
    cell.labelZan.text = mg.click;
    if ([mg.is_fav isEqualToString:@"1"]) {
        cell.imageViewZan.image = [UIImage imageNamed:@"我的_签到_留言_已点赞"];
    }else{
        cell.imageViewZan.image = [UIImage imageNamed:@"我的_签到_留言_点赞"];
    }
    cell.imageViewZan.userInteractionEnabled = YES;
    cell.labelZan.userInteractionEnabled = YES;
    cell.butZan.userInteractionEnabled = YES;
    [cell.imageViewZan setTag:indexPath.row];
    [cell.imageViewZan tapGesture:^(UIGestureRecognizer *ges) {
        [weakSelf clickButZanImageView:cell.imageViewZan.tag];
    }];
    [cell.labelZan setTag:indexPath.row];
    [cell.labelZan tapGesture:^(UIGestureRecognizer *ges) {
        [weakSelf clickButZanLabel:cell.labelZan.tag];
    }];

    cell.butZan.tag = indexPath.row;
    [cell.butZan addTarget:self action:@selector(clickButZan:) forControlEvents:UIControlEventTouchUpInside];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
#pragma mark - 去商城
-(void)goToShopping
{
    LSZFindOutMoreVC * vc = [[LSZFindOutMoreVC alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}
#pragma mark - 点赞
-(void)clickButZanImageView :(NSInteger)row
{
    [self clickWithWhererRow:row-1];
}
-(void)clickButZanLabel :(NSInteger)row
{
    [self clickWithWhererRow:row-1];
}
-(void)clickButZan:(UIButton *)button
{
    [self clickWithWhererRow:button.tag-1];
}
-(void)clickWithWhererRow :(NSInteger)row
{
    if (row >=self.arrayCheckRecord.count) {
        [self setStringWarning:@"请重新选择点赞对象!"];
        return;
    }
    LSZSignRecordMg * mg = nil;
    mg = self.arrayCheckRecord[row];
    if ([mg.is_fav isEqualToString:@"1"]) {
        [self setStringWarning:@"您已点过赞!"];
        return;
    }
    __weak typeof(self) weakSelf = self;
    [LSZRequestData theUserChecksToThumbUp:mg.id_id :^(BOOL isOk, NSString * string, NSDictionary * dic) {
        if (isOk == YES) {
            [weakSelf setStringWarning:string];
            mg.click = [NSString stringWithFormat:@"%zd",(long)[mg.click integerValue] +1];
            mg.is_fav = @"1";
            LSZSignInformationMg * SignInformationMg = nil;
            SignInformationMg = weakSelf.signInformationManager.arrayData[0];
            if ([SignInformationMg.sign_m isEqualToString:@"1"]) {
                NSIndexPath *indexPath=[NSIndexPath indexPathForRow:row+1 inSection:3];
                [weakSelf.tableViewSignIn reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
            }else{
                NSIndexPath *indexPath=[NSIndexPath indexPathForRow:row+1 inSection:2];
                [weakSelf.tableViewSignIn reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone];
            }
        }else{
            [weakSelf setStringWarning:string];
        }
    }];
}
#pragma mark - 早签到
-(void)clickButSignIn
{
    self.butSignIn.userInteractionEnabled = NO;
    [self viewPopupWindow];
}
#pragma mark - 公开留言
-(void)clickButPublic
{
    self.is_open = @"0";
    self.imageViewPublic.image = [UIImage imageNamed:@"我的_设置_关于_意见反馈_yes"];
    self.imageViewPrivacy.image = [UIImage imageNamed:@"我的_设置_关于_意见反馈_no"];
}
#pragma mark - 私密留言
-(void)clickButPrivacy
{
    self.is_open = @"1";
    self.imageViewPublic.image = [UIImage imageNamed:@"我的_设置_关于_意见反馈_no"];
    self.imageViewPrivacy.image = [UIImage imageNamed:@"我的_设置_关于_意见反馈_yes"];
}
#pragma mark - 去留言
-(void)signPrayerButClick
{
    __weak typeof(self) weakSelf = self;
    if (weakSelf.textViewLeaveMessage.text.length == 0) {
        [weakSelf setStringWarning:@"请填写早祷告留言!"];
    }else{
        [weakSelf.PopupScrollView removeFromSuperview];
        [LSZRequestData userSignIn:weakSelf.textViewLeaveMessage.text is_open:weakSelf.is_open type:@"2":^(BOOL isOk, NSString * string, NSDictionary * dic) {
            if (isOk == YES) {
                weakSelf.butSignIn.userInteractionEnabled = NO;
                weakSelf.butSignIn.backgroundColor = lightColor;
                weakSelf.page = 1;
                [weakSelf getSignInformation];
                [weakSelf getDailyCheckRecordData:weakSelf.page];
            }else{
                weakSelf.butSignIn.userInteractionEnabled = YES;
            }
            [weakSelf setStringWarning:string];
        }];
    }
}
#pragma mark - 移除弹窗
-(void)removePopView
{
    [self.PopupScrollView removeFromSuperview];
    self.butSignIn.userInteractionEnabled = YES;
}
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
    if (range.location < 200){
        return  YES;
    } else  if ([textView.text isEqualToString:@"\n"]) {
        //这里写按了ReturnKey 按钮后的代码
        return NO;
    }
    if (textView.text.length >=200) {
        [self setStringWarning:@"注意内容不能超过200个!"];
        return NO;
    }
    return YES;
}
- (BOOL)textViewShouldEndEditing:(UITextView *)textView
{
    return YES;
}
- (void)textViewDidChange:(UITextView *)textView
{
    self.countLabel.text = [NSString stringWithFormat:@"%zd/200", (long)self.textViewLeaveMessage.text.length];
}
#pragma mark - 排行榜
-(void)clickButList
{
    LSZSignListViewController * vc = [[LSZSignListViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}
#pragma mark - 记录
-(void)clickViewCheckRecords
{
    LSZSignInformationMg * mg = nil;
    mg = self.signInformationManager.arrayData[0];
    LSZMyCheckRecordViewController * vc = [[LSZMyCheckRecordViewController alloc]init];
    vc.headerUrl = mg.avatar;
    vc.userName = mg.username;
    vc.ranking = mg.ranking;
    vc.cumulativeNumber = mg.signin_total;
    
    [self.navigationController pushViewController:vc animated:YES];
}
-(CGFloat)initWithCheckStrHeigh :(NSString * )str
{
    CGFloat a;
    if (ScreenWidth == 320) {
        //5
        a = 13.5;
    }else if(ScreenWidth == 375){
        // 6 7
        a = 14;
    }else {
        //plus
        a = 14.5;
    }
    CGRect labTitleRect = [str boundingRectWithSize:CGSizeMake(ScreenWidth-80, ScreenHeight*9) options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading) attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:a] forKey:NSFontAttributeName] context:nil];
    return labTitleRect.size.height+15;
}
-(void)viewPopupWindow
{
    __weak typeof(self) weakSelf = self;
    weakSelf.PopupScrollView = [[TPKeyboardAvoidingScrollView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
    weakSelf.PopupScrollView.contentSize = CGSizeMake([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
    weakSelf.PopupScrollView.userInteractionEnabled = YES;
    weakSelf.PopupScrollView.backgroundColor = [UIColor colorWithWhite:0.2 alpha:0.5];
    [weakSelf.PopupScrollView tapGesture:^(UIGestureRecognizer * ges) {
        [weakSelf removePopView];
    }];
    [weakSelf.view addSubview:weakSelf.PopupScrollView];

    UIView * viewPopup = [[UIView alloc]init];
    viewPopup.backgroundColor = [UIColor whiteColor];
    [viewPopup.layer setMasksToBounds:YES];
    [viewPopup.layer setCornerRadius:2];
    [weakSelf.PopupScrollView addSubview:viewPopup];

    weakSelf.textViewLeaveMessage = [[UITextView alloc]init];
    weakSelf.textViewLeaveMessage.delegate = self;
    [weakSelf.textViewLeaveMessage.layer setBorderWidth:1];
    [weakSelf.textViewLeaveMessage.layer setBorderColor:divider.CGColor];
    [viewPopup addSubview:weakSelf.textViewLeaveMessage];

    UIButton * butPublic = [[UIButton alloc]init];
    [butPublic addTarget:self action:@selector(clickButPublic) forControlEvents:UIControlEventTouchUpInside];
    [viewPopup addSubview:butPublic];
    weakSelf.imageViewPublic = [[UIImageView alloc]init];
    weakSelf.imageViewPublic.image = [UIImage imageNamed:@"我的_设置_关于_意见反馈_yes"];
    [butPublic addSubview:weakSelf.imageViewPublic];
    UILabel * labelPublic = [[UILabel alloc]init];
    labelPublic.textColor = titleColorLSZ;
    labelPublic.text = @"公开留言";
    [butPublic addSubview:labelPublic];

    UIButton * butPrivacy = [[UIButton alloc]init];
    [butPrivacy addTarget:self action:@selector(clickButPrivacy) forControlEvents:UIControlEventTouchUpInside];
    [viewPopup addSubview:butPrivacy];
    weakSelf.imageViewPrivacy = [[UIImageView alloc]init];
    weakSelf.imageViewPrivacy.image = [UIImage imageNamed:@"我的_设置_关于_意见反馈_no"];
    [butPrivacy addSubview:weakSelf.imageViewPrivacy];
    UILabel * labelPrivacy = [[UILabel alloc]init];
    labelPrivacy.textColor = titleColorLSZ;
    labelPrivacy.text = @"私密留言";
    [butPrivacy addSubview:labelPrivacy];


    // 自定义文本框字数统计
    weakSelf.countLabel = [[UILabel alloc] init];
    weakSelf.countLabel.text = @"0/200";
    weakSelf.countLabel.textAlignment = NSTextAlignmentRight;
    weakSelf.countLabel.textColor = [UIColor redColor];
    weakSelf.countLabel.enabled = NO;
    [viewPopup addSubview:weakSelf.countLabel];

    UIButton * signPrayerBut = [[UIButton alloc]init];
    [signPrayerBut.layer setMasksToBounds:YES];
    [signPrayerBut setTitle:@"早祷告" forState:UIControlStateNormal];
    signPrayerBut.backgroundColor = redUIColor;
    [signPrayerBut addTarget:self action:@selector(signPrayerButClick) forControlEvents:UIControlEventTouchUpInside];
    [viewPopup addSubview:signPrayerBut];

    if (ScreenWidth == 320) {
        //5
        signPrayerBut.titleLabel.font = FONT_(14.5);
        weakSelf.countLabel.font = FONT_(13.5);
        labelPublic.font = FONT_(13.5);
        labelPrivacy.font = FONT_(13.5);

        viewPopup .frame = CGRectMake(10,(ScreenHeight-212)/2 ,ScreenWidth-20,180+35+10);
        weakSelf.textViewLeaveMessage.frame = CGRectMake(13, 13, viewPopup.frame.size.width-26, 116);
        butPublic.frame = CGRectMake(0, CGRectGetMaxY(weakSelf.textViewLeaveMessage.frame), viewPopup.frame.size.width/3, 35);
        butPrivacy.frame = CGRectMake(CGRectGetMaxX(butPublic.frame), CGRectGetMaxY(weakSelf.textViewLeaveMessage.frame), viewPopup.frame.size.width/3, 35);

        weakSelf.imageViewPublic.frame = CGRectMake(20, 10, 15, 15);
        labelPublic.frame = CGRectMake(CGRectGetMaxX(weakSelf.imageViewPublic.frame)+3, 10, butPublic.frame.size.width-CGRectGetMaxX(weakSelf.imageViewPublic.frame), 15);

        weakSelf.imageViewPrivacy.frame = CGRectMake(20, 10, 15, 15);
        labelPrivacy.frame = CGRectMake(CGRectGetMaxX(weakSelf.imageViewPrivacy.frame)+3, 10, butPrivacy.frame.size.width-CGRectGetMaxX(weakSelf.imageViewPrivacy.frame), 15);

        weakSelf.countLabel.frame = CGRectMake(CGRectGetMaxX(butPrivacy.frame), CGRectGetMaxY(weakSelf.textViewLeaveMessage.frame)+10, CGRectGetMaxX(weakSelf.textViewLeaveMessage.frame)-CGRectGetMaxX(butPrivacy.frame),15);

        signPrayerBut.frame = CGRectMake(30, CGRectGetMaxY(butPrivacy.frame)+10, viewPopup.frame.size.width-60, viewPopup.frame.size.height-CGRectGetMaxY(butPrivacy.frame)-20);
        [signPrayerBut.layer setCornerRadius: signPrayerBut.frame.size.height/2];
    }else if(ScreenWidth == 375){
        // 6 7
        signPrayerBut.titleLabel.font = FONT_(15);
        weakSelf.countLabel.font = FONT_(14);
        labelPublic.font = FONT_(14);
        labelPrivacy.font = FONT_(14);

        viewPopup .frame = CGRectMake(15,(ScreenHeight-222)/2 ,ScreenWidth-30,185+40+5);
        weakSelf.textViewLeaveMessage.frame = CGRectMake(13, 13, viewPopup.frame.size.width-26, 120);
        butPublic.frame = CGRectMake(0, CGRectGetMaxY(weakSelf.textViewLeaveMessage.frame), viewPopup.frame.size.width/3, 40);
        butPrivacy.frame = CGRectMake(CGRectGetMaxX(butPublic.frame), CGRectGetMaxY(weakSelf.textViewLeaveMessage.frame), viewPopup.frame.size.width/3, 40);

        weakSelf.imageViewPublic.frame = CGRectMake(20, 10, 17, 17);
        labelPublic.frame = CGRectMake(CGRectGetMaxX(weakSelf.imageViewPublic.frame)+4, 10, butPublic.frame.size.width-CGRectGetMaxX(weakSelf.imageViewPublic.frame), 17);

        weakSelf.imageViewPrivacy.frame = CGRectMake(20, 10, 17, 17);
        labelPrivacy.frame = CGRectMake(CGRectGetMaxX(weakSelf.imageViewPrivacy.frame)+4, 10, butPrivacy.frame.size.width-CGRectGetMaxX(weakSelf.imageViewPrivacy.frame), 17);

        weakSelf.countLabel.frame = CGRectMake(CGRectGetMaxX(butPrivacy.frame), CGRectGetMaxY(weakSelf.textViewLeaveMessage.frame)+10, CGRectGetMaxX(weakSelf.textViewLeaveMessage.frame)-CGRectGetMaxX(butPrivacy.frame),15);

        signPrayerBut.frame = CGRectMake(30, CGRectGetMaxY(butPrivacy.frame)+5, viewPopup.frame.size.width-60, viewPopup.frame.size.height-CGRectGetMaxY(butPrivacy.frame)-14);
        [signPrayerBut.layer setCornerRadius: signPrayerBut.frame.size.height/2];
    }else {
        //plus
        signPrayerBut.titleLabel.font = FONT_(15.5);
        weakSelf.countLabel.font = FONT_(14.5);
        labelPublic.font = FONT_(14.5);
        labelPrivacy.font = FONT_(14.5);

        viewPopup .frame = CGRectMake(20,(ScreenHeight-230)/2 ,ScreenWidth-40,190+45);
        weakSelf.textViewLeaveMessage.frame = CGRectMake(13, 13, viewPopup.frame.size.width-26, 124);
        butPublic.frame = CGRectMake(0, CGRectGetMaxY(weakSelf.textViewLeaveMessage.frame), viewPopup.frame.size.width/3, 45);
        butPrivacy.frame = CGRectMake(CGRectGetMaxX(butPublic.frame), CGRectGetMaxY(weakSelf.textViewLeaveMessage.frame), viewPopup.frame.size.width/3, 45);

        weakSelf.imageViewPublic.frame = CGRectMake(20, 10, 19, 19);
        labelPublic.frame = CGRectMake(CGRectGetMaxX(weakSelf.imageViewPublic.frame)+5, 10, butPublic.frame.size.width-CGRectGetMaxX(weakSelf.imageViewPublic.frame), 19);

        weakSelf.imageViewPrivacy.frame = CGRectMake(20, 10, 19, 19);
        labelPrivacy.frame = CGRectMake(CGRectGetMaxX(weakSelf.imageViewPrivacy.frame)+5, 10, butPrivacy.frame.size.width-CGRectGetMaxX(weakSelf.imageViewPrivacy.frame), 19);

        weakSelf.countLabel.frame = CGRectMake(CGRectGetMaxX(butPrivacy.frame), CGRectGetMaxY(weakSelf.textViewLeaveMessage.frame)+10, CGRectGetMaxX(weakSelf.textViewLeaveMessage.frame)-CGRectGetMaxX(butPrivacy.frame),15);

        signPrayerBut.frame = CGRectMake(30, CGRectGetMaxY(butPrivacy.frame)+5, viewPopup.frame.size.width-60, viewPopup.frame.size.height-CGRectGetMaxY(butPrivacy.frame)-14);
        [signPrayerBut.layer setCornerRadius: signPrayerBut.frame.size.height/2];
    }
}
-(void)setLowUIView
{
    self.viewLow = [[UIView alloc]init];
    self.viewLow.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.viewLow];
    if (ScreenWidth == 320) {
        //5
        self.viewLow.frame = CGRectMake(0,ScreenHeight-62-HOME_INDICATOR_HEIGHT,ScreenWidth,62);
    }else if(ScreenWidth == 375){
        // 6 7
        self.viewLow.frame = CGRectMake(0,ScreenHeight-64-HOME_INDICATOR_HEIGHT,ScreenWidth,64);
    }else {
        //plus
        self.viewLow.frame = CGRectMake(0,ScreenHeight-66-HOME_INDICATOR_HEIGHT,ScreenWidth,66);
    }
    self.butSignIn = [[UIButton alloc]init];
    self.butSignIn.frame = CGRectMake(15,10,ScreenWidth-30,self.viewLow.frame.size.height-20);
    self.butSignIn.backgroundColor = redUIColor;
    [self.butSignIn.layer setMasksToBounds:YES];
    [self.butSignIn.layer setCornerRadius:4];
    [self.butSignIn setTitle:@"早祷告" forState:UIControlStateNormal];
    [self.butSignIn addTarget:self action:@selector(clickButSignIn) forControlEvents:UIControlEventTouchUpInside];
    [self.viewLow addSubview:self.butSignIn];
}
#pragma mark - 规则
-(void)clickButRules:(UIButton *)but
{
    __weak typeof(self) weakSelf = self;
    [weakSelf clickButCancel];
    viewBackRules = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
    viewBackRules.backgroundColor = [UIColor blackColor];
    viewBackRules.alpha = 0.5;
    [weakSelf.view addSubview:viewBackRules];
    [viewBackRules tapGesture:^(UIGestureRecognizer *ges) {
        [weakSelf clickButCancel];
    }];

    viewRules = [[UIView alloc]init];
    viewRules.backgroundColor = [UIColor whiteColor];
    [viewRules.layer setMasksToBounds:YES];
    [viewRules.layer setCornerRadius:4];
    [weakSelf.view addSubview:viewRules];

    NSString * strOne = [[NSString alloc]init];
    NSString * strTwo = [[NSString alloc]init];
    int A;
    if (but.tag == 1) {
        strOne = @"签到规则";
        strTwo = @"祷告时间:每周一至周日 \n每日可祷告时间:00:00至10:00 \n祷告规则:\n1,每天早上10点前进行早祷告; \n2,每天只能祷告一次.";
        A = 0;
    }else{
        strOne = @"福音值抵现";
        strTwo = @"福音值可以兑换成主内商城余额,商城余额可以用来购买商品时抵现";
        A= 2;
    }
    UILabel* labelTitle = [[UILabel alloc]init];
    labelTitle.text = strOne;
    labelTitle.textColor = navColor;
    labelTitle.textAlignment = NSTextAlignmentCenter;
    [viewRules addSubview:labelTitle];

    UIButton * butCancel = [[UIButton alloc]init];
    [butCancel setImage:[UIImage imageNamed:@"小叉号"] forState:UIControlStateNormal];
    [butCancel addTarget:self action:@selector(clickButCancel) forControlEvents:UIControlEventTouchUpInside];
    [viewRules addSubview:butCancel];

    UILabel * labelConten = [[UILabel alloc]init];
    labelConten.textColor = titleColorLSZ;
    labelConten.text = strTwo;
    labelConten.numberOfLines = 0;
    [viewRules addSubview:labelConten];

    if (ScreenWidth == 320) {
        //5
        labelTitle.font = FONT_(16+A);
        labelConten.font = FONT_(13.5+A);
        viewRules.frame = CGRectMake(20, (ScreenHeight-140)/2, ScreenWidth-40, 140);
        labelTitle.frame = CGRectMake(50, 10, viewRules.frame.size.width-100, 18);
        butCancel.frame = CGRectMake( viewRules.frame.size.width-45,0,40,40 );
        labelConten.frame = CGRectMake(30, CGRectGetMaxY(labelTitle.frame)+5,viewRules.frame.size.width-60, viewRules.frame.size.height-CGRectGetMaxY(labelTitle.frame)-10);
    }else if(ScreenWidth == 375){
        // 6 7
        labelTitle.font = FONT_(16.5+A);
        labelConten.font = FONT_(14+A);
        viewRules.frame = CGRectMake(30, (ScreenHeight-150)/2, ScreenWidth-60, 150);
        labelTitle.frame = CGRectMake(55, 10, viewRules.frame.size.width-110, 20);
        butCancel.frame = CGRectMake( viewRules.frame.size.width-50,0,45,45 );

        labelConten.frame = CGRectMake(30, CGRectGetMaxY(labelTitle.frame)+5,viewRules.frame.size.width-60, viewRules.frame.size.height-CGRectGetMaxY(labelTitle.frame)-10);
    }else {
        //plus
        labelTitle.font = FONT_(17+A);
        labelConten.font = FONT_(14.5+A);
        viewRules.frame = CGRectMake(40, (ScreenHeight-158)/2, ScreenWidth-80, 158);
        labelTitle.frame = CGRectMake(60, 10, viewRules.frame.size.width-120, 22);
        butCancel.frame = CGRectMake( viewRules.frame.size.width-55,0,50,50 );
        labelConten.frame = CGRectMake(30, CGRectGetMaxY(labelTitle.frame)+5,viewRules.frame.size.width-60, viewRules.frame.size.height-CGRectGetMaxY(labelTitle.frame)-10);
    }
}
-(void)clickButCancel
{
    [viewBackRules removeFromSuperview];
    [viewRules removeFromSuperview];
}
#pragma mark - 签到成功
-(void)signInSuccessfully :(NSDictionary *)dic
{
    __weak typeof(self) weakSelf = self;
    viewBackSuccessfully = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
    viewBackSuccessfully.backgroundColor = [UIColor blackColor];
    viewBackSuccessfully.alpha = 0.5;
    [weakSelf.view addSubview:viewBackSuccessfully];
    [viewBackSuccessfully tapGesture:^(UIGestureRecognizer *ges) {
        [weakSelf successfulinterface];
    }];
    viewSuccessfully = [[UIView alloc]init];
    viewSuccessfully.backgroundColor = [UIColor whiteColor];
    [viewSuccessfully.layer setMasksToBounds:YES];
    [viewSuccessfully.layer setCornerRadius:8];
    [weakSelf.view addSubview:viewSuccessfully];
    [viewSuccessfully tapGesture:^(UIGestureRecognizer *ges) {
        [weakSelf successfulinterface];
    }];

//    butCancel = [[UIButton alloc]init];
//    [butCancel setImage:[UIImage imageNamed:@"签到_取消"] forState:UIControlStateNormal];
//    [butCancel addTarget:self action:@selector(successfulinterface) forControlEvents:UIControlEventTouchUpInside];
//    [self.view addSubview:butCancel];

    UILabel * labelTitle = [[UILabel alloc]init];
    labelTitle.textColor = titleColorLSZ;
    labelTitle.textAlignment = NSTextAlignmentCenter;
    [LSZSpecialPackaging setLabelAdaptiveSize:labelTitle font:15.5];
    labelTitle.text = [NSString stringWithFormat:@"签到第%@天",dic[@"data"][@"signdays"]];
    [viewSuccessfully addSubview:labelTitle];

    UILabel * labelExplain = [[UILabel alloc]init];
    labelExplain.textAlignment = NSTextAlignmentCenter;
    [LSZSpecialPackaging setLabelAdaptiveSize:labelExplain font:13];
    labelExplain.text = [NSString stringWithFormat:@"恭喜获得%@福音值",dic[@"data"][@"credit"]];
    labelExplain.textColor = lightColor;
    [viewSuccessfully addSubview:labelExplain];

    UIImageView * imageViewSuccessfully = [[UIImageView alloc]init];
    imageViewSuccessfully.image = [UIImage imageNamed:@"签到_图片"];
    [viewSuccessfully addSubview:imageViewSuccessfully];

    if (ScreenWidth == 320) {
        //5
        viewSuccessfully.frame = CGRectMake(40, 50+NAVIGATION_BAR_HEIGHT, ScreenWidth-80, ScreenHeight-50-NAVIGATION_BAR_HEIGHT-50);
        labelTitle.frame = CGRectMake(30,10,viewSuccessfully.frame.size.width-60 ,20);
        labelExplain.frame = CGRectMake(0, CGRectGetMaxY(labelTitle.frame)+2,viewSuccessfully.frame.size.width, 14);
    }else if(ScreenWidth == 375){
        if(iPhoneX){
            viewSuccessfully.frame = CGRectMake(45, 60+NAVIGATION_BAR_HEIGHT, ScreenWidth-90, ScreenHeight-NAVIGATION_BAR_HEIGHT-60-25-60);
        }else{
            viewSuccessfully.frame = CGRectMake(45, 60+NAVIGATION_BAR_HEIGHT, ScreenWidth-90, ScreenHeight-NAVIGATION_BAR_HEIGHT-60-60);
        }
        // 6 7
        labelTitle.frame = CGRectMake(30,10,viewSuccessfully.frame.size.width-60 ,22);
        labelExplain.frame = CGRectMake(0, CGRectGetMaxY(labelTitle.frame)+2,viewSuccessfully.frame.size.width, 16);
    }else{
        //plus
        viewSuccessfully.frame = CGRectMake(50, 65+NAVIGATION_BAR_HEIGHT, ScreenWidth-100, ScreenHeight-65-65-NAVIGATION_BAR_HEIGHT);
        labelTitle.frame = CGRectMake(30,10,viewSuccessfully.frame.size.width-60 ,24);
        labelExplain.frame = CGRectMake(0, CGRectGetMaxY(labelTitle.frame)+2,viewSuccessfully.frame.size.width, 18);
    }
    imageViewSuccessfully.frame = CGRectMake(0, CGRectGetMaxY(labelExplain.frame)+10, viewSuccessfully.frame.size.width, viewSuccessfully.frame.size.height-CGRectGetMaxY(labelExplain.frame)-10);
}
-(void)successfulinterface
{
    [viewBackSuccessfully removeFromSuperview];
    [viewSuccessfully     removeFromSuperview];
    [butCancel            removeFromSuperview];
}
-(UITableView *)tableViewSignIn
{
    if (_tableViewSignIn == nil) {
        _tableViewSignIn = [[UITableView alloc]initWithFrame:CGRectMake(0, NAVIGATION_BAR_HEIGHT, ScreenWidth, ScreenHeight-NAVIGATION_BAR_HEIGHT-HOME_INDICATOR_HEIGHT) style:UITableViewStyleGrouped];
        if (ScreenWidth == 320) {
            //5
            _tableViewSignIn.frame = CGRectMake(0,0,ScreenWidth,ScreenHeight-HOME_INDICATOR_HEIGHT);
        }else if(ScreenWidth == 375){
            // 6 7
            _tableViewSignIn.frame = CGRectMake(0,0,ScreenWidth,ScreenHeight-HOME_INDICATOR_HEIGHT);
        }else {
            //plus
            _tableViewSignIn.frame = CGRectMake(0,NAVIGATION_BAR_HEIGHT,ScreenWidth,ScreenHeight-NAVIGATION_BAR_HEIGHT-HOME_INDICATOR_HEIGHT);
        }
        _tableViewSignIn.delegate = self;
        _tableViewSignIn.dataSource = self;
        _tableViewSignIn.separatorColor = divider;
        _tableViewSignIn.separatorInset = UIEdgeInsetsMake(0, 20, 0, 20);
        _tableViewSignIn.estimatedRowHeight =0;
        _tableViewSignIn.estimatedSectionFooterHeight =0;
        _tableViewSignIn.estimatedSectionHeaderHeight =0;
        [self.view addSubview:_tableViewSignIn];
    }
    return _tableViewSignIn;
}

@end
